
from pages.base_page import BasePage
from selenium.webdriver.common.by import By


class CustomerPage(BasePage):
    url = "/crm/index.php?m=customer&a=cares"
    result_locator = (By.XPATH, '/html/body/div[5]/div[2]')
    error_locator =(By.XPATH,"/html/body/div/form/fieldset/div[1]")
    add_care_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[1]/div/a')  # 新建关怀

    def click_add_care(self):
        self.find_element(self.add_care_locator).click()
#返回增删改查后的提示信息
    def get_result_tips(self):
        return self.find_element(self.result_locator).text

#返回弹窗文本信息
    def get_alert_text(self):
        return self.driver.switch_to.alert.text

#返回报错弹窗文本信息
    def get_error_text(self):
        return self.find_element(self.error_locator).text

